<!DOCTYPE html>
<html>
<head>
	<title>上传反馈</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<style>
		body {
			font-family: Arial, sans-serif;
			background-color: #f2f2f2;
			margin: 0;
			padding: 20px;
		}

		.container {
			max-width: 400px;
			margin: 0 auto;
			background-color: #fff;
			border-radius: 5px;
			padding: 20px;
			box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
		}

		h1 {
			text-align: center;
			color: #333;
		}

		.upload-success {
			text-align: center;
			margin-top: 20px;
		}

		.upload-success input[type="text"] {
			width: 80%;
			padding: 5px;
			border: 1px solid #ccc;
			border-radius: 3px;
			margin-right: 5px;
		}

		.upload-success button {
			padding: 5px 10px;
			background-color: #4CAF50;
			color: white;
			border: none;
			border-radius: 3px;
			cursor: pointer;
		}
	</style>
</head>
<body>
	<div class="container">
		<h1>上传反馈</h1>
		<div class="upload-success">
			<?php
			if(isset($_POST['submit'])){
				$file = $_FILES['file'];
				$fileName = $file['name'];
				$fileTmpName = $file['tmp_name'];
				$fileSize = $file['size'];
				$fileError = $file['error'];
				$fileType = $file['type'];
				$fileExt = explode('.', $fileName);
				$fileActualExt = strtolower(end($fileExt));
				$allowed = array('jpg', 'jpeg', 'png', 'avi', 'wmv',  'mp4', 'mov', 'xlsx', 'xls', 'doc', 'docx');
				if(in_array($fileActualExt, $allowed)){
					if($fileError === 0){
						if($fileSize < 200000000){
							$fileNameNew = date('YmdHis') . "." . $fileActualExt;
							$fileDestination = 'uploads/' . $fileNameNew;
							move_uploaded_file($fileTmpName, $fileDestination);
				
							$url = "http://".$_SERVER['HTTP_HOST']."/uploads/".$fileNameNew;
							//$url = "http://".$_SERVER['HTTP_HOST']."/i/i/".$fileNameNew;
							echo "上传成功！<br><br>请点击复制：<input type='text' value='$url' id='url' readonly><button onclick='copyUrl()'>复制</button>";
						} else {
							echo "文件过大！";
						}
					} else {
						echo "上传文件出错！";
					}
				} else {
					echo "不支持的文件类型！";
				}
			}
			?>
		</div>
	</div>

	<script>
		function copyUrl() {
			var copyText = document.getElementById("url");
			copyText.select();
			copyText.setSelectionRange(0, 99999);
			document.execCommand("copy");
			alert("复制成功，请返回粘贴："+ copyText.value);
		}
	</script>
</body>
</html>
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
<script>LA.init({id:"KFunBsxDl2bThYnS",ck:"KFunBsxDl2bThYnS"})</script>
